clear all;



folder_path ='G:\1\';
file_list = dir(fullfile(folder_path));  % 获取所有txt文件的文件名
file_name_list = {file_list.name};  % 获取文件名列表
filenamelist = file_name_list(3:end); % 去掉系统默认的'.'和'..'目录

for i=1:length(filenamelist)

    imgfilepath = fullfile(folder_path, filenamelist(i));
    a=char(filenamelist(i));
    a=a(1:end-4);
    b = strrep(a, 'rx_', '');  % 去除 'rx_' 前缀
    b = strrep(b, '_', '');  % 去除剩余的下划线
    %     imgfilenamelist = imgfilenamelist(3:end); % 去掉系统默认的'.'和'..'目录
    opencsi(char(imgfilepath));
                       
    
    eval("save('" + fullfile("CSI_mat", b + ".mat") + "', '" + a + "');");

    a_value=eval('a');

    varToDelete=num2str(a_value);
    clear(varToDelete);

    clear csidata;
    clear csifilepath;
    clear a;


end